//
//  ByChaseNumberDetailCell.m
//  caipiao_ios
//
//  Created by mc on 2018/8/13.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByChaseNumberDetailCell.h"
#import "ByBetRecordTitleView.h"
#import "ByDocumentaryFiveValue.h"

@implementation ByChaseNumberDetailCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByChaseNumberDetailCell";
    ByChaseNumberDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.contentView.backgroundColor = BY_BACKGROUND_COLOR;
       
    }
    return self;
}


- (void)initViews{
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    UIView *backgroundView = [[UIView alloc] init];
    [self.contentView addSubview:backgroundView];
    [backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(6);
        make.right.equalTo(self.contentView).offset(-6);
        make.top.equalTo(self.contentView).offset(10);
        make.bottom.equalTo(self.contentView).offset(0);
    }];
    backgroundView.layer.cornerRadius = 10;
    backgroundView.backgroundColor = [UIColor whiteColor];
    
    
    ByBetRecordTitleView *titleView = [[ByBetRecordTitleView alloc] init];
    [backgroundView addSubview:titleView];
    [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(0);
        make.right.equalTo(backgroundView).offset(0);
        make.top.equalTo(backgroundView).offset(0);
        make.height.mas_equalTo(@40);
    }];
    titleView.titleLabel.text = @"追号跟踪";
    titleView.dottedLine.hidden = YES;
    
    
    ByDocumentaryFiveValue *titleView1 = [[ByDocumentaryFiveValue alloc] initWithFrame:CGRectMake(0, 40, SCREEN_WIDTH - 12, 41)];
    [backgroundView addSubview:titleView1];
    titleView1.valueLabel1.text = @"期数";
    titleView1.valueLabel2.text = @"投注方案";
    titleView1.valueLabel3.text = @"投注金额";
    titleView1.valueLabel4.text = @"投注时间";
    titleView1.valueLabel5.text = @"投注结果";
    titleView1.valueLabel1.textColor = [UIColor blackColor];
    titleView1.valueLabel2.textColor = [UIColor blackColor];
    titleView1.valueLabel3.textColor = [UIColor blackColor];
    titleView1.valueLabel4.textColor = [UIColor blackColor];
    titleView1.valueLabel5.textColor = [UIColor blackColor];
    
    ByDocumentaryFiveValue *valueView = [[ByDocumentaryFiveValue alloc] initWithFrame:CGRectMake(0, titleView1.bottom, SCREEN_WIDTH - 12, 41)];
    [backgroundView addSubview:valueView];
    valueView.valueLabel1.text = _netModel.playtype;
    valueView.valueLabel2.text = _netModel.bet_playtype;
    valueView.valueLabel3.text = [NSString stringWithFormat:@"%@元",_netModel.amount];
    valueView.valueLabel4.text = _netModel.add_time;
    valueView.valueLabel1.textColor = [UIColor blackColor];
    valueView.valueLabel2.textColor = [UIColor blackColor];
    valueView.valueLabel3.textColor = [UIColor blackColor];
    valueView.valueLabel4.textColor = [UIColor blackColor];
    valueView.valueLabel5.textColor = [UIColor blackColor];
    if (_netModel.is_prize.integerValue == 0) {
        valueView.valueLabel5.text = @"未开奖";
    }else if (_netModel.is_prize.integerValue == 1){
        valueView.valueLabel5.text = @"中奖";
    }else if (_netModel.is_prize.integerValue == 2){
        valueView.valueLabel5.text = @"未中奖";
    }
    
    
    for (int i = 0; i< 3; i++) {
        UILabel *centerLine = [[UILabel alloc] init];
        [backgroundView addSubview:centerLine];
        centerLine.backgroundColor = BY_LINE_COLOR;
        [centerLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(backgroundView).offset(0);
            make.right.equalTo(backgroundView).offset(0);
            make.top.equalTo(backgroundView).offset(40 + i * 41);
            make.height.mas_equalTo(@1);
        }];
    }
    
    
    
    for (int i = 1; i < 5; i++) {
        UILabel *line = [[UILabel alloc] init];
        [backgroundView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(backgroundView).offset((SCREEN_WIDTH - 10) / 5.0 * i);
            make.bottom.equalTo(backgroundView).offset(0);
            make.top.equalTo(backgroundView).offset(40);
            make.width.mas_equalTo(@1);
        }];
        line.backgroundColor = BY_LINE_COLOR;
    }
    
    
}

- (void)setNetModel:(ByNetModel *)netModel{
    _netModel = netModel;
    [self initViews];
    
}

@end
